﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bastanteo.Dominio;
using NHibernate;
using NHibernate.Criterion;

namespace Bastanteo.Persistencia.NH
{
    public class RepresentanteDAO : BaseDAO<Representante, Int32>, IRepresentanteDAO
    {

        public Representante ObtenerRepXDoc(string NumeroDocumento)
        {
            using (ISession sesion = NHibernateHelper.ObtenerSesion())
            {
                ICriteria busqueda = sesion.CreateCriteria(typeof(Representante));
                busqueda.Add(Restrictions.Eq("NumeroDocumento", NumeroDocumento));
                return busqueda.UniqueResult<Representante>();
            }
        }
    }
}